﻿using System;

namespace HexadecimalToDecimal
{
    class HexadecimalToDecimal
    {
        static int GetNumber(char symbol)
        {
            if (char.IsLetter(symbol))
            {
                return (symbol + 10) - 'A';
            }
            return symbol - '0';
        }
        static int ConvertHexadecimalToDecimal(string number)
        {
            number = number.ToUpper();
            int result = 0;
            for (int index = number.Length - 1, times = 1; index >= 0; index--, times *= 16)
            {
                result += GetNumber(number[index]) * times;
            }
            return result;
        }
        static void Main(string[] args)
        {
            Console.WriteLine(ConvertHexadecimalToDecimal("63a9ec"));
        }
    }
}
